package cn.exrick.xboot.entity.agency;

import cn.exrick.xboot.base.XbootBaseEntity;
import cn.exrick.xboot.common.constant.CommonConstant;
import cn.exrick.xboot.entity.Permission;
import cn.exrick.xboot.entity.Role;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

/**
 * @author Exrickx
 */
@Data
@Entity
@Table(name = "a_agency")
@TableName("a_agency")
public class Agency extends XbootBaseEntity {
    private static final long serialVersionUID = 1L;

    @Column(length=1000,unique = false,nullable = false)
    @ApiModelProperty(value = "用户名")
    private String name;
    @ApiModelProperty(value = "签约类型")
    private SignType signType=SignType.un;
    @ApiModelProperty(value = "省市类别")
    private String cityType;
    @ApiModelProperty(value = "省市类别描述")
    private String cityTypeDes;
    @ApiModelProperty(value = "经度")
    private String longitude;
    @ApiModelProperty(value = "纬度")
    private String latitude;
    @ApiModelProperty(value = "所属省份")
    private String cityId;
    @ApiModelProperty(value = "所属市")
    private String provinceId;
    @ApiModelProperty(value = "法人代表")
    private String representative;
    @ApiModelProperty(value = "电话")
    private String phone;

    @LastModifiedDate
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "签约时间")
    private Date contractTime;

    @ApiModelProperty(value = "地址")
    private String address;


    public enum SignType {
        un( "未签约" ),
        ing( "签约中"),
        ed( "已签约");
        private String desc;
        SignType(String desc) {
            this.desc = desc;
        }
        public String getDesc() {
            return desc;
        }
        public static SignType getByType(String desc) {
            for (SignType val : SignType.values()) {
                if (StringUtils.equals(val.desc, desc)) {
                    return val;
                }
            }
            return null;
        }
    }

//    @ApiModelProperty(value = "0女 1男 2保密")
//    @Column(length=1)
//    private Integer sex;


}
